<?php

if (!MEMBER)
    common::accessdenied();
$data->profile = profile::get(array('ID' => UID));
if (POST) {
    switch (PARAMS) {
        default:
        case 'upload':
            $data->profile->upload = profile::photo(array('ID' => UID, 'username' => USERNAME, 'image' => $_FILES['Filedata'], 'caption' => $_POST['caption']));
            if($data->profile->upload == 200) header('location: /'.LANG.'/profile/upload');
            break;
        case 'mini':
//          user::miniPhoto(array('UID'=>$_SESSION['UID'],'x'=>$_POST['x'],'y'=>$_POST['y']));
            break;
    }
}
if (PARAMS) {
    profile::photo(array('ID' => PARAMS), 'profile');
}
$data->TITLE = _('Profile Photo');
$data->DESCRIPTION = _('Add a profile photo.');
?>